package com.mym.demo;

/**
 * @author miao
 * @version 1.0
 * @date 2025/4/10 16:56
 * @description
 */
public class Test3 {
    public static void main(String[] args) {
        Chinese chinese = new Chinese();
        American american = new American();
        Indian indian = new Indian();
        Persons[] persons = new Persons[3];
        persons[0] = chinese;
        persons[1] = american;
        persons[2] = indian;
        for (int i = 0; i < persons.length; i++) {
            persons[i].eat();
        }

    }
}

abstract class Persons {
    public abstract void eat();
}

class Chinese extends Persons {

    @Override
    public void eat() {
        System.out.println("用筷子吃饭");
    }
}

class American extends Persons {

    @Override
    public void eat() {
        System.out.println("用刀叉吃饭");
    }
}

class Indian extends Persons {

    @Override
    public void eat() {
        System.out.println("用手抓饭");
    }
}
